home *** CD-ROM | disk | FTP | other *** search
- Path: engnews1.Eng.Sun.COM!taumet!clamage
- From: fjh@munta.cs.mu.OZ.AU (Fergus Henderson)
- Newsgroups: comp.std.c++
- Subject: Re: double const declarations
- Date: 28 Mar 1996 15:56:12 GMT
- Organization: Comp Sci, University of Melbourne
- Approved: clamage@eng.sun.com (comp.std.c++)
- Message-ID: <4jdvnj$o35@mulga.cs.mu.OZ.AU>
- References: <4jc2fa$bqu@arl-news-svc-2.compuserve.com>
- NNTP-Posting-Host: taumet.eng.sun.com
- X-Nntp-Posting-Host: munta.cs.mu.oz.au
- Content-Length: 679
- X-Lines: 23
- Originator: clamage@taumet
-
- Philippe Verdy <100105.3120@compuserve.com> writes:
-
- >template <class T, class CT>
- >class SmartPtr2 {
- > SmartPtr2(T* p) { mp = const_cast<CT>(p) ; }
- > CT & Dereference() {
- > return *mp ;
- > }
- > private :
- > CT *mp ;
- >} ;
- >template <class T> class ConstSmartPtr : SmartPtr<T, T> {} ;
- >template <class T> class FreeSmartPtr : SmartPtr<T, const T> {} ;
-
- You forgot to delegate the constructors.
-
- (Of course, if C++ supported tempate typedefs, there wouldn't be
- any need to delegate constructors in examples like this.
- Unfortunately it doesn't.)
-
- --
- Fergus Henderson WWW: http://www.cs.mu.oz.au/~fjh
- fjh@cs.mu.oz.au PGP: finger fjh@128.250.37.3
-
-
- [ comp.std.c++ is moderated. To submit articles: try just posting with ]
- [ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
- [ FAQ: http://reality.sgi.com/employees/austern_mti/std-c++/faq.html ]
- [ Policy: http://reality.sgi.com/employees/austern_mti/std-c++/policy.html ]
- [ Comments? mailto:std-c++-request@ncar.ucar.edu ]
-